

import mainRoute from './src/routes/index.js'
import express from 'express';
import bodyParser from "express";
import cron from "node-cron";
import taskFun from "./src/util/task.js";

const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(mainRoute)
const PORT = 3000;


// cron.schedule('* * * * *', () => {
//     console.log('执行任务');
//     taskFun().then(r => {})
// });

cron.schedule( '*/20 5-6 * * *', () => {
    console.log('执行任务');
    taskFun().then(r => {})
});

app.listen(PORT, () => {
    console.log(`http://localhost:${PORT}`);
});
